<?php
class DirectoryUtils
{
	public static function createDirectoryChain($pathString)
	{
		if (!is_dir($_SERVER['DOCUMENT_ROOT']."/".$pathString))
		{
			$parts = explode('/', $pathString);
			$count = count($parts);
			$path  = $_SERVER['DOCUMENT_ROOT'];
			
			for ($i = 0; $i < $count; $i++)
			{
				$path.= "/".$parts[$i];
				if (!is_dir($path))
					mkdir( $path, 0777);
			}
		}
	}
}
?>
